package main

import "fmt"

func cal(c, quit chan int) {
	x, y := 1, 1
	//一开始的时候将x写入c
	for {
		select {
		case c <- x:
			x = y
			y = x + y
		case <-quit:
			fmt.Println("quit")
			return
		}
	}

}

func main() {
	c := make(chan int)
	quit := make(chan int)

	go func() {
		for i := 0; i < 10; i++ {
			//一开始呗阻塞了
			fmt.Println(<-c)
		}
		quit <- 666
	}()

	cal(c, quit)

}
